﻿using System;
using System.Windows.Forms;
using 逻辑;

namespace 中国象棋
{

    public partial class form1 : Form
    {
        public Button[,] buttons1;
        public Button[,] buttons2;
        public QiPan qiPan;
        public Game game;
        public form1()
        {

            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            buttons1 = new Button[10, 9]
            {
                {button2,button3,button4,button17,button1,button5,button6,button7,button8 },
                {button15,button14,button13,button18,button16,button12,button11,button10,button9 },
                {button26,button25,button24,button19,button27,button23,button22,button21,button20 },
                {button35,button34,button33,button91,button36,button32,button31,button30,button29 },
                {button44,button43,button42,button37,button45,button41,button40,button39,button38 },
                {button53,button52,button51,button46,button54,button50,button49,button48,button47 },
                {button62,button61,button60,button55,button63,button59,button58,button57,button56 },
                {button71,button70,button69,button64,button72,button68,button67,button66,button65 },
                {button80,button79,button78,button73,button81,button77,button76,button75,button74 },
                {button89,button88,button87,button82,button90,button86,button85,button84,button83 },
            };
            buttons2 = new Button[10, 9]
            {
                {button89,button88,button87,button82,button90,button86,button85,button84,button83 },
                {button80,button79,button78,button73,button81,button77,button76,button75,button74 },
                {button71,button70,button69,button64,button72,button68,button67,button66,button65 },
                {button62,button61,button60,button55,button63,button59,button58,button57,button56 },
                {button53,button52,button51,button46,button54,button50,button49,button48,button47 },
                {button44,button43,button42,button37,button45,button41,button40,button39,button38 },
                {button35,button34,button33,button91,button36,button32,button31,button30,button29 },
                {button26,button25,button24,button19,button27,button23,button22,button21,button20 },
                {button15,button14,button13,button18,button16,button12,button11,button10,button9 },
                {button2,button3,button4,button17,button1,button5,button6,button7,button8 },
            };
            qiPan = new QiPan(buttons1, buttons2, imageList1, imageList2, label1);
            game = new 逻辑.Game(qiPan);
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 9; j++)
                {
                    buttons1[i, j].Click += game.Buttons_Click;
                }

            game.ReadyQiZi();

        }
            private void button1_MouseDown(object sender, MouseEventArgs e)
            {

            }

            private void button1_Click(object sender, EventArgs e)
            {

            }

        private void 黑方投降ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            game.黑方投降();
        }

       

        private void 红方投降ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            game.红方投降();
        }

        

        private void button2_Click(object sender, EventArgs e)
        {

        }

        private void button7_Click(object sender, EventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void 重新开始ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            game.ReStar();
        }

        private void button92_Click(object sender, EventArgs e)
        {
            game.红方投降();
        }

        private void button93_Click(object sender, EventArgs e)
        {
            game.黑方投降();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button94_Click(object sender, EventArgs e)
        {

        }

        private void 返回选择页面ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 悔棋ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            game.UsingBack();
            game.ClearRemark();
        }

       

        private void button8_Click(object sender, EventArgs e)
        {

        }
    }
  
}

